import java.util.ArrayList;


public class TokenList extends ArrayList<Token> {
	public TokenList() {
		this.add(new Token("program", 1));
		this.add(new Token("begin", 2));
		this.add(new Token("end", 3));
		this.add(new Token("int", 4));
		this.add(new Token("if", 5));
		this.add(new Token("then", 6));
		this.add(new Token("else", 7));
		this.add(new Token("while", 8));
		this.add(new Token("loop", 9));
		this.add(new Token("read", 10));
		this.add(new Token("write", 11));
		this.add(new Token(";", 12));
		this.add(new Token(",", 13));
		this.add(new Token("=", 14));
		this.add(new Token("!", 15));
		this.add(new Token("[", 16));
		this.add(new Token("]", 17));
		this.add(new Token("&&", 18));
		this.add(new Token("||", 19));
		this.add(new Token("(", 20));
		this.add(new Token(")", 21));
		this.add(new Token("+", 22));
		this.add(new Token("-", 23));
		this.add(new Token("*", 24));
		this.add(new Token("!=", 25));
		this.add(new Token("==", 26));
		this.add(new Token("<", 27));
		this.add(new Token(">", 28));
		this.add(new Token("<=", 29));
		this.add(new Token(">=", 30));
	}
	
	public int getTokenNumber (String token) {
		int tok_num = 0;
		for (Token t : this) {
			if (t.getToken().equals(token)) {
				tok_num = t.getNumber();
			}
		}
		return tok_num;
	}
	
	public boolean isReservedOrSymbol (String token) {
		for (Token t: this) {
			if (t.getToken().equals(token)) {
				return true;
			}
		}
		return false;
	}
}
